<?php

/**
 * Class of Validate Factory
 *
 * @author BUI TIEN HIEP
 */
class ValidateFactory {
    /**
     * Get a validate instance
     * @param type $policy
     * @return \AbstractValidateFactory
     */
    public static function getValidateInstance($policy)
    {
        $template = $policy['template'];
        $instance = null;
        switch ($template)
        {
            case 'receipt':
                $instance = new ValidateReceipt($policy);
                break;
            case 'TurnedDay':
                $instance = new ValidateTurnedDay($policy);
                break;
            case 'Amount':
                $instance = new ValidateAmount($policy);
                break;
            case 'Category':
                $instance = new ValidateCategory($policy);
                break;
            case 'PerDiem':
                $instance = new ValidatePerDiem($policy);
                break;
            case 'Advance':
                $instance = new ValidateAdvance($policy);
                break;
        }
        return $instance;
    }
}

